﻿@model IList<Coleotrack.Data.Issue>

@{
    ViewBag.Title = "All Issues";
    Layout = "~/Views/Shared/_TwoColumn.cshtml";
}

@section Head {
    <link href="@Url.Content("~/Content/Issue.css")" rel="stylesheet" type="text/css" />
    <script src="@Url.Content("~/Scripts/IssueList.js")" type="text/javascript"></script>
}

@section SubMenu {
    <ul class="submenu">
    <li class="upper">Filter options</li>
    <li class="upper">Sort options</li>
</ul>
}

<h1>All Issues</h1>

<div class="issue-commands">
    <div class="toolbar">
        <div class="command">
            <a class="issue-details-list selected" title="List"><img src="@Url.Content("~/Content/Images/16x16/list.png")" alt="List" width="16px" height="16px" /></a>
        </div>
        <div class="command">
            <a class="issue-details-details" title="Details"><img src="@Url.Content("~/Content/Images/16x16/details.png")" alt="List" width="16px" height="16px" /></a>
        </div>
        <div class="command begin-group">
            
        </div>
    </div>
</div>

<div class="issues">
@foreach (var issue in Model)
{
    string due = "";
    string dueClass = "";

    if (issue.Due.HasValue)
    {
        if (issue.Due.Value.Date == DateTime.Now.Date)
        {
            due = "today";
            dueClass = "fixit-today";
        }
        else
        {
            due = issue.Due.Value.Date.ToShortDateString();
        }
    }
    
    <div class="issue-section">
        <div class="issue-title-section">
            <a href="@Url.Action("Details", "Issue", new { id = issue.Id, area="" })"><span class="issue-id"> #@issue.Project.Abbreviation-@issue.Id</span> @issue.Title</a>
            <div class="issue-expand">
                <a class="issue-expand-toggle" title="toggle details"><img src="@Url.Content("~/Content/Images/16x16/expand.png")" alt="List" width="16px" height="16px" /></a>
            </div>
        </div>
        <div class="issue-additional-details">
            <div class="issue-detail-group">
                <span class="issue-description">@issue.Description</span>
            </div>
        </div>
        <div class="issue-detail-section">
            @if (issue.Due.HasValue)
            {
                <div class="issue-detail-group-one-line">
                    <span class="issue-detail fixed @dueClass" title="Fix it @due">@due</span>
                </div>
            }
            <div class="issue-detail-group-one-line">
                <span class="issue-detail fixed priority priority-@issue.Priority.Order" title="Priorität @issue.Priority.Name">@issue.Priority.Name</span>
            </div>
            <div class="issue-detail-group-one-line">
                <span class="issue-detail fixed project" title="Project @issue.Project.Name">@issue.Project.Name</span>
            </div>
            <div class="issue-detail-group-one-line">
                <span class="issue-detail fixed assigned-to" title="Assigned to @issue.AssignedTo.Profile.FullName">@issue.AssignedTo.Profile.FullName</span>
            </div>
            @foreach (var tag in issue.Tags)
            {
                <div class="issue-detail-group-one-line">
                    <span class="issue-detail dynamic" title="@tag.Name">@tag.Name</span>
                </div>
            }
        </div>
        <br style="clear: left;" />
    </div>
}
</div>